<template>
  <view class="com-page-root">
    <slot></slot>
  </view>
</template>

<script setup lang="ts">
import { onBeforeMount } from "vue";

const { title } = withDefaults(
  defineProps<{
    title?: string;
  }>(),
  {
    title: "默认标题",
  }
);

onBeforeMount(() => {
  if (title) {
    uni.setNavigationBarTitle({
      title,
    });
  }
});
</script>

<style>
.com-page-root {
  position: relative;
  width: 100vw;
  height: 100vh;
}
</style>
